package com.xinsilu.hospital.controller;

import com.xinsilu.common.Result;
import com.xinsilu.hospital.entity.BedTable;
import com.xinsilu.hospital.service.IBedTableService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

@RestController
@RequestMapping("/api/hospital/bedTable")
public class BedTableController {

    @Autowired
    private IBedTableService iBedTableService;

    @RequestMapping("/getlist")
    public Object getList() {
        List<BedTable> list = iBedTableService.getlist();
        return Result.ok(list);
    }

    @RequestMapping("/getbyks")
    public Object getbyks(BedTable bedTable) {
        List<BedTable> list = iBedTableService.getbyks(bedTable);
        return Result.ok(list);
    }

    @RequestMapping("/upxiu")
    public Object upxiu(BedTable bedTable) {
        boolean save = iBedTableService.updatechan(bedTable);
        if(save){
            return Result.ok("成功");
        }else{
            return Result.ok("失败");
        }
    }

    @RequestMapping("/shan")
    public Object shan(BedTable bedTable) {
        boolean save = iBedTableService.updateshan(bedTable);
        if(save){
            return Result.ok("成功");
        }else{
            return Result.ok("失败");
        }
    }

}
